﻿using System;
using System.Collections.Generic;
using System.ComponentModel;

namespace Rabbit.Model
{
    public class UserSettingList : List<UserSettings>
    {
    }
    public class Emotion
    {
        public int Index { get; set; }
        public string Name { get; set; }
        public string Path { get; set; }
    }

    public class EmotionClass
    {
        public string ClassName { get; set; }
        public List<Emotion> EmotionList { get; set; }
    }
    public class EmotionList : List<EmotionClass>
    {
    }

    /// <summary>
    /// this class is used for the intelligense in publishing status richtextbox
    /// </summary>
    public class FollowingNameList
    { 
        public DateTime LastUpdateTime { get; set; }
        public long LastUpdateCursorID { get; set; }
        public List<string> FollowingList { get; set; }
    }

    public class UserSettings : IComparable<UserSettings>, INotifyPropertyChanged,ICloneable
    {
        public string TokenID { get; set; }
        public string TokenSecret { get; set; }
        public string UserName { get; set; }
        public long UserID { get; set; }
        public DateTime LastAccessTime { get; set; }

        private string _Theme;
        public string Theme
        {
            get { return _Theme; }
            set
            {
                _Theme = value;
                NotifyPropertyChanged("Theme");
            }
        }

        private bool? _PopupForNewStatus;
        public bool? PopupForNewStatus
        {
            get
            {
                return _PopupForNewStatus;
            }
            set
            {
                if (value != _PopupForNewStatus)
                {
                    _PopupForNewStatus = value;
                    NotifyPropertyChanged("PopupForNewStatus");
                }
            }
        }

        private bool? _PopupForNewComment;
        public bool? PopupForNewComment
        {
            get
            {
                return _PopupForNewComment;
            }
            set
            {
                if (value != _PopupForNewComment)
                {
                    _PopupForNewComment = value;
                    NotifyPropertyChanged("PopupForNewComment");
                }
            }
        }

        private bool? _PopupForMetionedMe;
        public bool? PopupForMetionedMe
        {
            get
            {
                return _PopupForMetionedMe;
            }
            set
            {
                if (value != _PopupForMetionedMe)
                {
                    _PopupForMetionedMe = value;
                    NotifyPropertyChanged("PopupForMetionedMe");
                }
            }
        }

        private bool? _PopupForNewLetter;
        public bool? PopupForNewLetter
        {
            get
            {
                return _PopupForNewLetter;
            }
            set
            {
                if (value != _PopupForNewLetter)
                {
                    _PopupForNewLetter = value;
                    NotifyPropertyChanged("PopupForNewLetter");
                }
            }
        }

        private double? _UpdateInterval;
        public double? UpdateInterval
        {
            get
            {
                return _UpdateInterval;
            }
            set
            {
                if (value != _UpdateInterval)
                {
                    _UpdateInterval = value;
                    NotifyPropertyChanged("UpdateInterval");
                }
            }
        }
        
        private bool? _IsTwinkleSysTrayIcon;
        public bool? IsTwinkleSysTrayIcon
        {
            get
            {
                return _IsTwinkleSysTrayIcon;
            }
            set
            {
                if (value != _IsTwinkleSysTrayIcon)
                {
                    _IsTwinkleSysTrayIcon = value;
                    NotifyPropertyChanged("IsTwinkleSysTrayIcon");
                }
            }
        }

        private bool? _IsPlayingSound;
        public bool? IsPlayingSound
        {
            get
            {
                return _IsPlayingSound;
            }
            set
            {
                if (value != _IsPlayingSound)
                {
                    _IsPlayingSound = value;
                    NotifyPropertyChanged("IsPlayingSound");
                }
            }
        }

        //public string CaptureScreenHotKey { get; set; }
        private string _CaptureScreenHotKey;
        public string CaptureScreenHotKey
        {
            get
            {
                return _CaptureScreenHotKey;
            }
            set
            {
                if (value != _CaptureScreenHotKey)
                {
                    _CaptureScreenHotKey = value;
                    NotifyPropertyChanged("CaptureScreenHotKey");
                }
            }
        }

        private string _GetLetterHotKey;
        public string GetLetterHotKey
        {
            get
            {
                return _GetLetterHotKey;
            }
            set
            {
                if (value != _GetLetterHotKey)
                {
                    _GetLetterHotKey = value;
                    NotifyPropertyChanged("GetLetterHotKey");
                }
            }
        }

        private string _GetCommentHotKey;
        public string GetCommentHotKey
        {
            get
            {
                return _GetCommentHotKey;
            }
            set
            {
                if (value != _GetCommentHotKey)
                {
                    _GetCommentHotKey = value;
                    NotifyPropertyChanged("GetCommentHotKey");
                }
            }
        }

        private string _GeStatusHotKey;
        public string GetStatusHotKey
        {
            get
            {
                return _GeStatusHotKey;
            }
            set
            {
                if (value != _GeStatusHotKey)
                {
                    _GeStatusHotKey = value;
                    NotifyPropertyChanged("GetStatusHotKey");
                }
            }
        }

        private string _GeMetionedMeHotKey;
        public string GetMetionedMeHotKey
        {
            get
            {
                return _GeMetionedMeHotKey;
            }
            set
            {
                if (value != _GeMetionedMeHotKey)
                {
                    _GeMetionedMeHotKey = value;
                    NotifyPropertyChanged("GetMetionedMeHotKey");
                }
            }
        }

        private bool? _HelpPublicizing;
        public bool? HelpPublicizing
        {
            get
            {
                return _HelpPublicizing;
            }
            set
            {
                if (value != _HelpPublicizing)
                {
                    _HelpPublicizing = value;
                    NotifyPropertyChanged("HelpPublicizing");
                }
            }
        }

        private double? _PopupMessageShowTime;
        public double? PopupMessageShowTime
        {
            set
            {
                if (_PopupMessageShowTime != value)
                {
                    _PopupMessageShowTime = value;
                    NotifyPropertyChanged("PopupMessageShowTime");
                }
            }
            get
            {
                return _PopupMessageShowTime;
            }
        }
        private double? _MainWindowOpacity;
        public double? MainWindowOpacity
        {
            get
            {
                return _MainWindowOpacity;
            }
            set
            {
                if (value != _MainWindowOpacity)
                {
                    _MainWindowOpacity = value;
                    NotifyPropertyChanged("MainWindowOpacity");
                }
            }
        }


        private double? _MainWindowBackgroundOpacity;
        public double? MainWindowBackgroundOpacity
        {
            get
            {
                return _MainWindowBackgroundOpacity;
            }
            set
            {
                if (value != _MainWindowBackgroundOpacity)
                {
                    _MainWindowBackgroundOpacity = value;
                    NotifyPropertyChanged("MainWindowBackgroundOpacity");
                }
            }
        }


        public FollowingNameList MyFollowingNameList { get; set; }

        public int CompareTo(UserSettings other)
        {
            return LastAccessTime.CompareTo(other.LastAccessTime)*-1;
        }

        public event PropertyChangedEventHandler PropertyChanged;
        private void NotifyPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        public object Clone()
        {
            return this.MemberwiseClone();
        }
    }
}
